Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a default gzip compression level globally #138

Merged
merged 12 commits into from
Jan 16, 2024
Merged

Set a default gzip compression level globally #138

merged 12 commits into from
Jan 16, 2024

Conversation

rhpvorderman
Copy link
Collaborator

This simplifies the previous setup where the default was determined by the backend.

I set the default to 1 for now. Most people will have python-isal installed, and this would have been the default for None-level compression for most users. I prefer promoting python-isal anywhere possible and as xopen states on the README that it chooses the most efficient way possible a level of 1 seems appropriate.

I am also open to setting it to 5, however. I don't think it is that important. As most upstream applications have their own preferred default anyway.

@rhpvorderman
Copy link
Collaborator Author

I forgot to mention, but this started as a refactor because I think the _open_gz function got a little messy. Setting a global default for compression level allowed removing a lot of code.

Copy link
Collaborator

@marcelm marcelm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! (Only one complaint about language ...)

I haven’t checked in detail whether the logic is still equivalent, but I’ll trust you and the tests.

src/xopen/__init__.py Outdated Show resolved Hide resolved
@rhpvorderman
Copy link
Collaborator Author

I haven’t checked in detail whether the logic is still equivalent, but I’ll trust you and the tests.

I set a default threads at one point, but had to conclude that this changed the logic and changed it back. Also the reason to choose level 1 by default is that currently python-isal is chosen for compression when it is available. Setting it to 5 or 6 would change this behavior. So I think the logic is still equivalent, except that level 1 is chosen rather than level 2 (python-isal default) but that is OK (and more consistent).

@marcelm marcelm merged commit ca7a41b into main Jan 16, 2024
19 checks passed
@marcelm marcelm deleted the simplifygzopen branch January 16, 2024 22:25
@marcelm
Copy link
Collaborator

marcelm commented Jan 16, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants